import { BasicColumn } from "@/components/Table";
import { formatToDateTime } from "@/utils/dateUtil";


export const tableColumns: BasicColumn[] = [
  {
    title: '字典类型',
    dataIndex: 'type',
  },
  {
    title: '字典名称',
    dataIndex: 'name',
  },
  {
    title: '字典编码',
    dataIndex: 'code',
  },
  {
    title: '字典描述',
    dataIndex: 'desc',
  },
  {
    title: '字典排序',
    dataIndex: 'sort'
  },
  {
    title: '创建日期',
    dataIndex: 'createDate',
    width: 180,
    customRender: ({ record }) => {
      return formatToDateTime(record.createDate);
    },
  },
  {
    title: '操作',
    dataIndex: 'operate',
    fixed: 'right',
    slots: {
      customRender: 'operate'
    }
  }
]

export const addDictionaryModalRules = {
  name: [
    { required: true, message: '请输入字典名称' }
  ],
  code: [
    { required: true, message: '请输入字典编码' }
  ],
  type: [
    { required: true, message: '请输入字典类型' }
  ]
}